﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Configuration;
using System.Web;
using System.Web.UI;



/// <summary>
/// Summary description for Common
/// </summary>
public class Common
{
    public Common()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public static string DBConnectionString
    {
        get
        {
            String cnStr = WebConfigurationManager.ConnectionStrings["myDBConnectionString1"].ConnectionString;
            return cnStr;
        }
    }
    public static void JShowMessageBox(string message)
    {
        string script = String.Format("jAlert('{0}', 'Alert Dialog');", message);
        Page myPage = HttpContext.Current.CurrentHandler as Page;
        myPage.ClientScript.RegisterClientScriptBlock(myPage.GetType(), "msg1", script, true);
    }
    public static void ShowMessageBox(string message)
    {
        string script = String.Format("alert('{0}');", message);
        Page myPage = HttpContext.Current.CurrentHandler as Page;
        myPage.ClientScript.RegisterClientScriptBlock(myPage.GetType(), "msg1", script, true);
    }


}

public static class StaticCommon
{
    public static object CheckForDBNull(this string str)
    {
        return str == null ? (object)DBNull.Value : str;
    }
}